package _2025_3_12;

class d2 implements Runnable{
    private int index;
    d2(int index){
        this.index=index;
    }
    @Override
    public void run() {
        System.out.println("Thread "+index+" is ruuning");
    }
}
public class demo2  {
    public static void main(String[] args) throws InterruptedException {
        Thread[] thread=new Thread[20];
        for (int i = 0; i <20 ; i++) {
            thread[i]=new Thread(new d2(i));
            thread[i].start();
        }
        for (int i = 0; i <20 ; i++) {
           try {
               thread[i].join();
           } catch (InterruptedException e) {
               throw new RuntimeException(e);
           }
        }
        System.out.println("ok");
    }
}
